const UserDB = require('../../db/users_db')

/*
 * 查询用户数据
 * @params query 查询字段
 */

 async function searchUsers (ctx){
     
    const query = ctx.request.query;

    let end = []

    await UserDB.find(query)
                .then(resData =>{
                    end = resData
                })
                .catch(error =>{
                    end = {
                        status: 500,
                        msg: error
                    }
                })
                
    ctx.body = end;
     
 }

 module.exports = searchUsers;